<template>
    <div>
        <h1>登录</h1>
            <label for="username">Username:</label>
            <input type="text" id="username" v-model="username">

            <label for="password">Password:</label>
            <input type="password" id="password" v-model="password">
            <button type="submit" @click="login">Login</button>
    </div>
</template>

<script setup>
import { ref,inject } from 'vue';
const $axios = inject("$axios");

const username = ref('');
const password = ref('');
async function login() {
    console.log('Username:', username.value);
    console.log('Password:', password.value);
   const response = await $axios.get('/user/test').catch(error => {
        console.log(error);
    });
    console.log(response);
    alert(response.data.data)
}
</script>

<style scoped>
h1 {
    text-align: center;
}


form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

label {
    margin-bottom: 10px;
}

input {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    border: none;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background-color: #3e8e41;
}
</style>